Sets the defaultSchemas keys in the SchemaCollection#1421
Conversation
| @@ -1,5 +1,6 @@ | |||
|
|
|||
| import MongoCollection from './MongoCollection'; | |||
| import { defaultColumns } from '../../../Schema'; | |||
There was a problem hiding this comment.
not really happy with that circular dependency, nor the fact that the adapter depends upon parse-server... but otherwise that would defer the responsibility to the router (which is not good). Solution would be to introduce a SchemaController
Current coverage is
|
|
Put it into the router as it acts as a controller in some ways... |
|
@flovilmart updated the pull request. |
src/Routers/SchemasRouter.js
Outdated
|
|
||
| function injectDefaultSchema(schema) { | ||
| if (Array.isArray(schema)) { | ||
| let schemas = schema.map((s) => { |
There was a problem hiding this comment.
Rather than have a function that accepts a schema or an array of schemas, can we have one that only accepts a single schema, and do the map outside the function if it needs it?
|
Does this test fail if your changes aren't included? |
|
The test don't fail :/ ... probably because the full schema is set when you explicitly create it... also, just doing a GET won't work as the schema is not found... |
|
Dang. Do you think it would be too much work to make a test that creates the legacy data by digging around on Mongo directly? |
|
Yeah I should probably write a bad schema directly to mongo... |
|
@flovilmart updated the pull request. |
src/Routers/SchemasRouter.js
Outdated
| function getAllSchemas(req) { | ||
| return req.config.database.schemaCollection() | ||
| .then(collection => collection.getAllSchemas()) | ||
| .then(schemas => { |
There was a problem hiding this comment.
If you want to be more concise, you could do
then(schemas => schemas.map(injectDefaultSchema))
Up to you though.
There was a problem hiding this comment.
that's really valid...
|
Pushing the consisensee thing and squashing after |
|
@flovilmart updated the pull request. |
fixes #1388